﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Com.Toook.AutoDownloadHtml.DownloadHtml.ParsePage.Entity
{
    public class Leaf
    {
        public Leaf()
        {
        }
        public Step CurrentLinkUrl
        {
            get
            {
                return currentLinkUrl;
            }
        }
        public Step CurrentLinkText
        {
            get
            {
                return currentLinkText;
            }
        }
        public Step CurrentImgUrl
        {
            get
            {
                return currentImgUrl;
            }
        }
        public Step CurrentImgText
        {
            get
            {
                return currentImgText;
            }
        }
        public Step CurrentDescription
        {
            get
            {
                return currentDescription;
            }
        }
        public Step CurrentActor
        {
            get
            {
                return currentActor;
            }
        }
        public Step CurrentDirector
        {
            get
            {
                return currentDirector;
            }
        }
        public Step CurrentYear
        {
            get
            {
                return currentYear;
            }
        }
        public Step CurrentArea
        {
            get
            {
                return currentArea;
            }
        }
        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextLinkUrl()
        {
            indexUrl++;
            if (indexUrl < linkUrl.Count)
            {
                currentLinkUrl = linkUrl[indexUrl];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextLinkUrl()
        {
            indexUrl = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddLinkUrlStep(Step step)
        {
            linkUrl.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextLinkText()
        {
            indexText++;
            if (indexText < linkText.Count)
            {
                currentLinkText = linkText[indexText];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextLinkText()
        {
            indexText = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddLinkTextStep(Step step)
        {
            linkText.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextImgUrl()
        {
            indexImgUrl++;
            if (indexImgUrl < imgUrl.Count)
            {
                currentImgUrl = imgUrl[indexImgUrl];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextImgUrl()
        {
            indexImgUrl = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddImgUrlStep(Step step)
        {
            imgUrl.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextImgText()
        {
            indexImgText++;
            if (indexImgText < imgText.Count)
            {
                currentImgText = imgText[indexImgText];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextImgText()
        {
            indexImgText = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddImgTextStep(Step step)
        {
            imgText.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextDescription()
        {
            indexDescription++;
            if (indexDescription < description.Count)
            {
                currentDescription = description[indexDescription];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextDescription()
        {
            indexDescription = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddDescriptionStep(Step step)
        {
            description.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextActor()
        {
            indexActor++;
            if (indexActor < actor.Count)
            {
                currentActor = actor[indexActor];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextActor()
        {
            indexActor = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddActorStep(Step step)
        {
            actor.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextDirector()
        {
            indexDirector++;
            if (indexDirector < director.Count)
            {
                currentDirector = director[indexDirector];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextDirector()
        {
            indexDirector = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddDirectorStep(Step step)
        {
            director.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextYear()
        {
            indexYear++;
            if (indexYear < year.Count)
            {
                currentYear = year[indexYear];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextYear()
        {
            indexYear = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddYearStep(Step step)
        {
            year.Add(step);
        }

        /// <summary>
        /// 移到下一步.开始位置在所有步骤之前，就像DataReader.Read()
        /// </summary>
        /// <returns></returns>
        public bool NextArea()
        {
            indexArea++;
            if (indexArea < area.Count)
            {
                currentArea = area[indexArea];
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 重置到所有步骤之前
        /// </summary>
        public void ResetNextArea()
        {
            indexArea = -1;
        }
        /// <summary>
        /// 增加解析步骤
        /// </summary>
        /// <param name="step"></param>
        public void AddAreaStep(Step step)
        {
            area.Add(step);
        }
        /// <summary>
        /// 重置所有List&lt;Step&gt;到第一步之前
        /// </summary>
        public void ResetAll()
        {
            ResetNextActor();
            ResetNextArea();
            ResetNextDescription();
            ResetNextDirector();
            ResetNextImgText();
            ResetNextImgUrl();
            ResetNextLinkText();
            ResetNextLinkUrl();
            ResetNextYear();
        }
        public List<Step> LinkUrlList
        {
            get
            {
                return linkUrl;
            }
        }
        public List<Step> LinkTextList
        {
            get
            {
                return linkText;
            }
        }
        public List<Step> ImgUrlList
        {
            get
            {
                return imgUrl;
            }
        }
        public List<Step> ImgTextList
        {
            get
            {
                return imgText;
            }
        }
        public List<Step> DescriptionList
        {
            get
            {
                return description;
            }
        }
        public List<Step> ActorList
        {
            get
            {
                return actor;
            }
        }
        public List<Step> DirectorList
        {
            get
            {
                return director;
            }
        }
        public List<Step> YearList
        {
            get
            {
                return year;
            }
        }
        public List<Step> AreaList
        {
            get
            {
                return area;
            }
        }
        private List<Step> linkUrl = new List<Step>();
        private List<Step> linkText = new List<Step>();
        private List<Step> imgUrl = new List<Step>();
        private List<Step> imgText = new List<Step>();
        private List<Step> description = new List<Step>();
        private List<Step> actor = new List<Step>();
        private List<Step> director = new List<Step>();
        private List<Step> year = new List<Step>();
        private List<Step> area = new List<Step>();

        private Step currentLinkUrl = null;
        private Step currentLinkText = null;
        private Step currentImgUrl = null;
        private Step currentImgText = null;
        private Step currentDescription = null;
        private Step currentActor = null;
        private Step currentDirector = null;
        private Step currentYear = null;
        private Step currentArea = null;

        private int indexUrl = -1;
        private int indexText = -1;
        private int indexImgUrl = -1;
        private int indexImgText = -1;
        private int indexDescription = -1;
        private int indexActor = -1;
        private int indexDirector = -1;
        private int indexYear = -1;
        private int indexArea = -1;
    }
}
